#ifndef _UIWINDOWIMPL_H_
#define _UIWINDOWIMPL_H_

#include "stdafx.h"
#include "uicontrolimpl.h"

class CUiWindowsImpl :		public IUIWindow,
						//public CUiControlImpl,
						public CUnknownImp,
						public CWindowWnd, 
						public INotifyUI
{
public:
	CUiWindowsImpl(void);
	virtual ~CUiWindowsImpl(void);

public:
	BEGIN_STDCOM_MAP
		STDCOM_INTERFACE_ENTRY(IUIWindow)
		STDCOM_INTERFACE_ENTRY_UNKNOWN_(IUIWindow)
		//STDCOM_INTERFACE_BASECLASS_ENTRY_(CUiControlImpl, IUiControl)
	END_STDCOM_MAP

	//IUiWindows
	std_method_(void*, CreateUiWindow)(void* hWnd);
	std_method_(int, DestroyUiWindow)();
	std_method_(int, AddUiWindow)(void* hWnd);
	std_method_(int, ShowUiWindow)(int nCmdShow);
	std_method_(int, SetResourceFile)(LPSTRING file);
	std_method_(int, SetResource)(HINSTANCE instance, LPSTRING path);
	std_method_(int, SendMessage)(const NotifyEvent* event);
	std_method_(int, PostMessage)(const NotifyEvent* event);
	std_method_(int, TranslateMessage)(const NotifyEvent* event);
	std_method(BindEvent)(IBase* pEvents);
	std_method(UnBindEvent)();

	LPSTRING GetWindowClassName() const;
	UINT GetClassStyle() const;
	void Notify(TNotifyUI& msg);
	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
	LRESULT OnKeyDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
private:
	basic_tstring	m_strResFile;
	basic_tstring	m_file;
public:
	CPaintManagerUI m_pm;
	CWndShadow*		m_pWndShadow;
	CButtonUI*		m_pCloseBtn;
	CButtonUI*		m_pMaxBtn;
	CButtonUI*		m_pRestoreBtn;
	CButtonUI*		m_pMinBtn;
	CButtonUI*		m_pSearch;

private:
	_lComPtr<IUIEvent>	m_pEvent;
};

#endif 
